package com.zl.controller;

import com.zl.User;
import com.zl.component.Users;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;

//@Controller
//public class UserController {
//    public void test(String name){
//        System.out.println("hello, "+name);
//    }
//}
@Controller
public class UserController {
    //属性注入
    //@Autowired
//    @Resource
//    private  UserService userService;
//    //构造方法注入
//    private UserService userService;
//    @Autowired
//    public UserController(UserService userService) {
//        this.userService = userService;
//    }
//    //Setter注入
//    private UserService userService;
//    @Autowired
//    public void setUserService(UserService userService) {
//        this.userService = userService;
//    }
//    public User getUser(String name){
//        return userService.user(name);
//    }

    //@Resource(name = "user1")
    @Autowired
    @Qualifier(value = "user1")
    private User user;
    public User getUser(){
        return user;
    }
}
